export function print(
  contentDom = "print-content",
  iframeDom = "print-iframe"
) {
  if (!!window.ActiveXObject || "ActiveXObject" in window) {
    // IE浏览器
    let page = window.open("", "_blank"); // 打开一个新窗口，用于打印
    page.document.write(document.getElementById(contentDom).innerHTML); // 写入打印页面的内容
    page.document.execCommand("print");
    page.close(); // 关闭打印窗口
  } else {
    let printHtml = document.getElementById(contentDom).innerHTML;
    let iframe = document.getElementById(iframeDom);
    iframe.contentWindow.document.body.innerHTML = "";
    iframe.contentWindow.document.write(printHtml);
    iframe.contentWindow.focus();
    iframe.contentWindow.print();
  }
}
